
package GUI;
 

 
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;

import com.jgoodies.forms.factories.DefaultComponentFactory;

/**
 
 * This class creates instance of AddRequestPanel       
 
 * to display when needed       
 
 * @author Natali
 
 *  
 
 */
 
public class AddRequest extends JPanel implements ActionListener {
 
	private static final long serialVersionUID = 1L;
    private JButton canButton;
    private JButton btnSubmit;
	private JButton btnNewButton;
	private JTextArea curStatus;
	private JTextArea chaDes;
	private JTextArea argu;
	private JTextArea comm;
	private JComboBox infoSystem;
    


	public AddRequest() {
        	
                setLayout(null);
                JLabel lblNewJgoodiesTitle = DefaultComponentFactory.getInstance().createTitle("Add request");
 
                lblNewJgoodiesTitle.setFont(new Font("David", Font.BOLD | Font.ITALIC, 17));
 
                lblNewJgoodiesTitle.setBounds(241, 48, 152, 70);
 
                add(lblNewJgoodiesTitle);
 
                
 
                JLabel lblNewJgoodiesLabel = DefaultComponentFactory.getInstance().createLabel("Related information system:");
 
                lblNewJgoodiesLabel.setFont(new Font("Arial", Font.BOLD, 12));
 
                lblNewJgoodiesLabel.setBounds(11, 161, 172, 34);
 
                add(lblNewJgoodiesLabel);
 
                
 
                
 
                JLabel lblNewJgoodiesLabel_1 = DefaultComponentFactory.getInstance().createLabel("Current status description:");
 
                lblNewJgoodiesLabel_1.setFont(new Font("Arial", Font.BOLD, 12));
 
                lblNewJgoodiesLabel_1.setBounds(11, 238, 155, 28);
 
                add(lblNewJgoodiesLabel_1);
 
               
                
 
                JLabel lblChangeDescription = DefaultComponentFactory.getInstance().createLabel("Change description:");
 
                lblChangeDescription.setFont(new Font("Arial", Font.BOLD, 12));
 
                lblChangeDescription.setBounds(11, 324, 113, 17);
 
                add(lblChangeDescription);
 
                
     
 
                JLabel lblArgument = DefaultComponentFactory.getInstance().createLabel("Argument:");
 
                lblArgument.setFont(new Font("Arial", Font.BOLD, 12));
 
                lblArgument.setBounds(11, 401, 88, 28);
 
                add(lblArgument);
 
                  
 
                JLabel lblNewJgoodiesLabel_2 = DefaultComponentFactory.getInstance().createLabel("Comments:");
 
                lblNewJgoodiesLabel_2.setFont(new Font("Arial", Font.BOLD, 12));
 
                lblNewJgoodiesLabel_2.setBounds(11, 486, 88, 14);
 
                add(lblNewJgoodiesLabel_2);
 
               
                
 
                canButton = new JButton("Cancel");
 
                canButton.setIcon(new ImageIcon(AddRequest.class.getResource("/Picture/Button-Close-icon.png")));
 
                canButton.setBounds(36, 631, 141, 47);
 
                add(canButton);
 
                
 
                btnSubmit = new JButton("Submit");
 
                btnSubmit.setIcon(new ImageIcon(AddRequest.class.getResource("/Picture/Ok-icon.png")));
 
                btnSubmit.setBounds(380, 631, 141, 47);
 
                add(btnSubmit);
 
                
 
                JLabel lblNewLabel_1 = new JLabel("");
 
                lblNewLabel_1.setIcon(new ImageIcon(AddRequest.class.getResource("/Picture/folder-full-add-icon.png")));
 
                lblNewLabel_1.setBounds(10, 10, 128, 131);
 
                add(lblNewLabel_1);
 
                
 
                btnNewButton = new JButton("press to attach");
                
                btnNewButton.addActionListener(this);
 
                btnNewButton.setIcon(new ImageIcon(AddRequest.class.getResource("/Picture/Attach-icon.png")));
 
                btnNewButton.setBounds(206, 541, 172, 57);
 
                add(btnNewButton);
                
                curStatus = new JTextArea();
                curStatus.setBounds(176, 226, 258, 50);
                add(curStatus);
                
                comm = new JTextArea();
                comm.setBounds(176, 302, 258, 50);
                add(comm);
                
                argu = new JTextArea();
                argu.setBounds(176, 467, 258, 50);
                add(argu);
                
                chaDes = new JTextArea();
                chaDes.setBounds(176, 386, 258, 50);
                add(chaDes);
                
                infoSystem = new JComboBox();
                infoSystem.setModel(new DefaultComboBoxModel(new String[] {"", "student information system", "lecturer information system", "worker information system", "moodle", "library system", "class computers", "lab computers", "farm computers ", "web site"}));
                infoSystem.setBounds(193, 162, 204, 34);
                add(infoSystem);
 
        }
 
    public JTextArea getCurStatus() {
	return curStatus;
    }


    public void setCurStatus(JTextArea curStatus) {
    this.curStatus = curStatus;
    }


    public JTextArea getChaDes() {
	return chaDes;
    }


    public void setChaDes(JTextArea chaDes) {
	this.chaDes = chaDes;
    }


    public JTextArea getArgu() {
	return argu;
    }


    public void setArgu(JTextArea argu) {
	this.argu = argu;
    }


    public JTextArea getComm() {
	return comm;
    }


    public void setComm(JTextArea comm) {
	this.comm = comm;
    }


    public JButton getCanButton() {
	return canButton;
    }


    public JButton getBtnSubmit() {
	return btnSubmit;
    }


    public JButton getBtnNewButton() {
	return btnNewButton;
    }


    public JComboBox getInfoSystem() {
	return infoSystem;
    }


    public void setInfoSystem(JComboBox infoSystem) {
	this.infoSystem = infoSystem;
    }

	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getSource().equals(btnNewButton)) {
			final JFileChooser fc = new JFileChooser();
			int returnVal = fc.showOpenDialog(this);
			if (returnVal == JFileChooser.APPROVE_OPTION) {
				File file = fc.getSelectedFile();
				String patch = file.getPath();
				System.out.println(patch);
			}
			
		}
		
	}
}
 